package com.glut.forum.common.utils;

import java.io.Serializable;
import java.util.Collection;

/**
 * 工具类的规范例子
 *
 * @author 晓风轻 https://xwjie.github.io/PLMCodeTemplate/
 */
public class StringUtil {

    public static boolean isEmpty(CharSequence cs) {

        return cs == null || cs.length() == 0;

    }

    public static boolean isEmpty(Collection<?> collection) {

        return collection == null || collection.size() == 0;

    }
    public static boolean isEmpty(Serializable n) {

        return n == null;

    }


    public static boolean equal(CharSequence obj1, CharSequence obj2) {

        CheckUtil.notNull(obj1, "notEqual第一个参数为空");

        CheckUtil.notNull(obj2, "notEqual第二个参数为空");

        // 长度相等才判断
        if (obj1.length() == obj2.length()) {

            return obj1.equals(obj2);

        }
        return false;
    }
}
